import { QQMapWX } from "./qqmap-wx-jssdk";
export class QQMap
{
    private qqmapsdk:any;
    private ready:boolean=false;
    constructor(key:string,callback?:Function){
        this.qqmapsdk = new QQMapWX({
            key:''
        });
        this.ready=true;
    }
    isReady(){
        return this.ready;
    }
    createMap(id:string){
        return new Promise((resolve,reject)=>{
            return reject('map is not ready');
        });
    }
    createMarker(map:any,lnglat:any){
        return new Promise((resolve,reject)=>{
            return reject('map is not ready');
        });
    }
    getCurrentPosition(option?:any){
        const options:any={
            ...option
        };
        return new Promise((resolve,reject)=>{
            this.qqmapsdk.reverseGeocoder({
                ...options,
                success:(res:any)=>{
                    console.log(res);
                    resolve(res);
                },
                fail:(res:any)=>{
                    console.log(res);
                    reject(res);
                }
            })
        });
    }
    getPosition(address:any){
        return new Promise((resolve,reject)=>{
            return reject('map is not ready');
        });
    }
    getAddress(lnglat:any){
        return new Promise((resolve,reject)=>{
            return reject('map is not ready');
        });
    }
}